﻿<div class="docs-section-source @Class">
    @if (!NoToolbar)
    {
    <MudToolBar DisableGutters="true" Dense="true">
        @if (ShowCode && !String.IsNullOrEmpty(Code2))
        {
            <MudButton Variant="Variant.Filled" Size="Size.Small" DisableElevation="true" Color="@Button1Color" OnClick="@(e => SwapCode(Code))">@ButtonTextCode1</MudButton>
            <MudButton Variant="Variant.Filled" Size="Size.Small" DisableElevation="true" Color="Button2Color" Class="ml-2" OnClick="@(e => SwapCode(Code2))">@ButtonTextCode2</MudButton>
        }
        <MudSpacer/>
        <MudTooltip Text="@TooltipSourceCodeText" Placement="Placement.Top">
            <MudIconButton Icon="@Icons.Material.Filled.Code" Size="Size.Small" Class="pa-3" OnClick="OnShowCode" />
        </MudTooltip>

        <MudTooltip Text="Edit on TryMudBlazor" Placement="Placement.Top">
            <MudIconButton Icon="@Icons.Material.Filled.Create" Size="Size.Small" Class="pa-3" OnClick="EditOnTryMudBlazor" />
        </MudTooltip>

        @if (!String.IsNullOrEmpty(CurrentCode))
        {
            <MudTooltip Text="Copy Code" Placement="Placement.Top">
                <MudIconButton Icon="@Icons.Material.Filled.FileCopy" Size="Size.Small" Class="pa-3" @onclick="CopyTextToClipboard" />
            </MudTooltip>
        }
        @if (!String.IsNullOrEmpty(GitHubFolderName))
        {
            <MudTooltip Text="View the source on GitHub" Placement="Placement.Top">
                <MudIconButton Icon="@Icons.Custom.Brands.GitHub" Size="Size.Small" Class="pa-3" Link="@GitHubSourceCode" Target="_blank" />
            </MudTooltip>
        }
    </MudToolBar>
    }
    <div class="docs-source-code @(ShowCode? "docs-show-code" : "docs-hide-code")">
        @CodeComponent(CurrentCode)
    </div>
</div>
